/*
package cn.taskservice.jwt.serviceImpl;

import cn.taskservice.jwt.config.JwtPropertiesConfig;
import cn.taskservice.jwt.service.TokenStoreService;
import lombok.RequiredArgsConstructor;
import org.springframework.context.annotation.Primary;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Component;

import java.util.concurrent.TimeUnit;
*/
/**
 * token以及黑/白名单缓存至redis
 *//*

@Component
@RequiredArgsConstructor
public class CacheTokenStoreServiceImpl implements TokenStoreService {

    private static final String TOKEN_RENEW_KEY = "jwt:renew:";
    private static final String TOKEN_BLACKLIST_KEY = "jwt:blacklist:";

    private final StringRedisTemplate redisTemplate;
    private final JwtPropertiesConfig jwtProperties;

    */
/**
     * 判断是否需要续期（未续期 或 距上次续期时间超过 renewInterval）
     *//*

    @Override
    public boolean shouldRenew(String token) {
        String key = TOKEN_RENEW_KEY + token;
        Boolean hasKey = redisTemplate.hasKey(key);
        return hasKey == null || !hasKey;
    }

    */
/**
     * 标记 token 已续期，设置 redis 缓存防止频繁续期
     *//*

    @Override
    public void markAsRenewed(String token) {
        String key = TOKEN_RENEW_KEY + token;
        redisTemplate.opsForValue().set(key, "1", jwtProperties.getRenewInterval(), TimeUnit.SECONDS);
    }

    */
/**
     * 将 token 加入黑名单（失效处理）
     *//*

    @Override
    public void invalidateToken(String token) {
        String key = TOKEN_BLACKLIST_KEY + token;
        redisTemplate.opsForValue().set(key, "1", jwtProperties.getExpiration(), TimeUnit.SECONDS);
    }

    */
/**
     * 判断 token 是否在黑名单中
     *//*

    @Override
    public boolean isBlacklisted(String token) {
        String key = TOKEN_BLACKLIST_KEY + token;
        Boolean hasKey = redisTemplate.hasKey(key);
        return hasKey != null && hasKey;
    }
}
*/
